package com.ruoyi.common.utils;


import java.text.DecimalFormat;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @类名: NumberUtils
 * @描述:
 * @作者: liudf
 * @日期: 2021/7/19 13:08
 */
public class NumberUtils {

    public static String buildSerial(int num){
        AtomicInteger val = new AtomicInteger(num);
        int nextVal = val.incrementAndGet();
        return String.format("%06d", nextVal);
    }

    public static String buildSerial03(int num){
        AtomicInteger val = new AtomicInteger(num);
        int nextVal = val.incrementAndGet();
        return String.format("%03d", nextVal);
    }

    static DecimalFormat df = new DecimalFormat("#.00");

    public static String formatInt(Integer num){
        if (num == null){
            return "0";
        }
        return df.format(num);
    }

}
